#include "vectors.h"
#include <math.h>
using namespace std;

  vector::vector()
  {
          x=0;
          y=0;
  }
  
  vector::vector(float a,float b)
  {
          x=a;
          y=b;
  }
  
  vector::~vector()
  {
  }

  vector& vector::operator =(vector &a)
  {
          x=a.x;
          y=a.y;
          return *this;
  }
  
  vector& operator +(vector a,vector b)
  {
          a.x=a.x+b.x;
          a.y=a.y+b.y;
          return a;
  }
  
  vector& operator -(vector a,vector b)
  {
          a.x=a.x-b.x;
          a.y=a.y-b.y;
          return a;
  }

  float operator *(vector&a,vector&b)
  {
          return a.x*b.x+a.y*b.y;
  }
  
  float vector::length()
  {
          return sqrt((float)(x*x+y*y));
  }
  
  vector& operator *(float a,vector& v)
  {
          vector l;
          l.x=v.x*a;
          l.y=v.y*a;
          return l;
  }
  
  float vector::triple()
  {
        float l;
        l=sqrt(x*x+y*y);
        l=l*l*l;
        return l;
  }
